﻿using AutoMapper;
using MediatR;
using S.Breeding.Domain;
using S.Breeding.Infrastructure;
using S.Breeding.Read.Api.Application.Command.DeathManageCommand;

namespace S.Breeding.Read.Api.Application.CommandHandlers.DeathManageCommandHandlers
{
    public class DeathManageEarCommandHandlers : IRequestHandler<DeathManageEarCommand, List<DeathManage>>
    {
        private readonly IRepository<DeathManage> repository;
        private readonly IMapper mapper;
        public DeathManageEarCommandHandlers(IRepository<DeathManage> repository, IMapper mapper)
        {
            this.repository = repository;
            this.mapper = mapper;
        }
        public async Task<List<DeathManage>> Handle(DeathManageEarCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetValues(x => x.Earbugles == request.Earbugles);
        }
    }
}
